﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;

namespace XYAC.Framework.MonitorTireMaterialOnline.Entities
{
    [Table("User")]
    public class User : EntityBase<int>
    {
        /// <summary>
        /// 用户ID，主键
        /// </summary>
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public override int ID { get; set; }
        /// <summary>
        /// 用户名
        /// </summary>
        [DataMember]
        public string Username { get; set; }
        /// <summary>
        /// 密码（哈希处理）
        /// </summary>
        public string PasswordHash { get; set; }
        /// <summary>
        /// 角色（例如：管理员、普通用户等）
        /// </summary>
        public UserRole Role { get; set; }
        /// <summary>
        /// 上次登录时间
        /// </summary>
        public DateTime? LastLoginTime { get; set; }
        /// <summary>
        /// 是否激活
        /// </summary>
        public bool? IsActive { get; set; }
        /// <summary>
        /// 班次Id
        /// </summary>
        //public int? GroupId { get; set; }
        /// <summary>
        /// 用户创建时间
        /// </summary>
        public DateTime CreateDate { get; set; } = DateTime.Now;
        public DateTime LastLogoutTime { get; internal set; }
        public override bool? IsDeleted { get; set; }
    }
}
